package cn.chenxinjie.hrm.feign;

import cn.chenxinjie.hrm.doc.CourseDoc;
import cn.chenxinjie.hrm.query.CourseDocQuery;
import cn.chenxinjie.hrm.util.AjaxResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author 陈鑫杰
 * @date 2022/3/15 17:39
 */
@Component
public class CourseDocFallback implements FallbackFactory<CourseDocFeign> {

    @Override
    public CourseDocFeign create(Throwable throwable) {
        return new CourseDocFeign() {
            @Override
            public AjaxResult addCourseDoc(List<CourseDoc> list) {
                return AjaxResult.me().setSuccess(false).setMessage("上线失败了!");
            }

            @Override
            public AjaxResult removeCourseDoc(List<Long> list) {
                return AjaxResult.me().setSuccess(false).setMessage("下线失败了!");
            }

            @Override
            public AjaxResult queryCourses(CourseDocQuery query) {
                return AjaxResult.me().setSuccess(false).setMessage("搜索失败!");
            }
        };
    }
}
